<!--用户管理·编辑-->

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>编辑用户</title>
    <link rel="stylesheet" type="text/css" href="/static/css/wanshan/lq.datetimepick.css"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <style>
        body {
            background: #4cb6cb;
            color: #666;
            font: 12px/150% Arial,Verdana, "microsoft yahei";
        }
        h1{
            text-align: center;
            font-size: 36px;
            color: white;
            margin-top: 5px;
        }
        div, dl, dt, dd, ol, ul, li, h2, h3, h4, h5, h6, p, blockquote, pre, button, fieldset, form, input, legend, textarea, th, td {
            margin: 0;
            padding: 0;
        }

        button,input,optgroup,select,textarea {
            margin: 0;
            font: inherit;
            color: inherit;
            outline: none;
        }

        /*#file{
            position: relative;
            left:100px;
            top:15px;
            border-radius: 5px;
            background:#2ea0b6;
        }*/

        .pc-kk-form{
            padding:60px 420px;
        }
        .pc-kk-form h1{
            margin-bottom: 10%;
        }
        .pc-kk-form-list{
            background:#fff;
            border:1px solid #e5e5e5;
            border-radius:5px;
            height:44px;
            line-height:44px;
            margin-bottom:35px;
        }
        .pc-kk-form-list input{
            width:60%;
            border:none;
            background:none;
            /*color:#9fa3a7;*/
            font-size:16px;
            height: 36px;
            padding: 4px 10px;
            text-align: center;
        }
        .pc-kk-form-list textarea{
            background:none;
            border:none;
            height:60px;
            padding:10px;
            resize:none;
            width:94%;
            line-height:22px;
            /*color:#9fa3a7;*/
            font-size:18px;
        }
        /*.pc-kk-form-list span{
            font-size: 12px;
        }
        .pc-kk-form-list #sp{
            width:200px;
              height:32px;
              line-height:32px;
              color:#999;
        }*/
        .nice-select{
            position: relative;
            background: #fff url(/static/images/sj.png) no-repeat right center;
            background-size:18px;
            width:47%;
            float:left;
            border:1px solid #e5e5e5;
            border-radius:5px;
            height:44px;
            line-height:44px;
        }
        .nice-selecter{
            position: relative;
            background-size:18px;
            width:47%;
            float:left;
            border:1px solid #e5e5e5;
            border-radius:5px;
            height:44px;
            line-height:44px;
            background: white;
        }
        .nice-select ul{
            width: 100%;
            display: none;
            position: absolute;
            left: -1px;
            top: 44px;
            overflow: hidden;
            background-color: #fff;
            max-height: 150px;
            overflow-y: auto;
            border: 1px solid #b9bcbf;
            z-index: 9999;
            border-radius:5px;

        }
        .nice-select ul li{
            padding-left:10px;
        }
        .nice-select ul li:hover{
            background:#f8f4f4;
        }
        .pc-kk-form-list-clear{
            background:none;
            border:none;
        }
        .pc-kk-form-btn button{
            background:#2ea0b6;
            color:#fff;
            border:none;
            width:100%;
            height:50px;
            line-height:50px;
            font-size:16px;
            border-radius:50px;
        }

        span{
            margin-left: 5%;
            font-size: 14px;
            /*color: #03A9F4;
            background: #FFEB3B;*/
            padding: 1%;
        }


        @media screen and (max-width: 750px){
            .pc-kk-form{
                padding:55px 10px !important;
            }
            .datetime-arr,.datetime-time1{
                display: none !important;
                height: 0;
            }
            #lq-datetimepick{
                left: 0 !important;
                width: 95% !important;
            }

        }

        @media screen and (max-width: 1500px) and (min-width: 750px){
            .pc-kk-form{
                padding:55px 20% !important;
            }
        }


        em{font-style:normal;font-size:14px;}
        .form-group {margin:0 auto !important;}
        .form-group-txt{height:32px;line-height:32px;padding:0 10px;}
        .form-control,
        .simulation-input {
            width: 100%;
            line-height: 16px;
            font-size: 22px;
            background: none;
            outline: none;
            background-color: #fff;
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
            -ms-box-sizing: border-box;
            box-sizing: border-box;
            margin: 0 8px;
            transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s;
        }

    </style>
    <script type="text/javascript">
        function checkform(){
            var realname=document.getElementById("realname").value;
            var reg_ = /^[\u4E00-\u9FA5]{2,5}$/;
            if(reg_.test(realname)==false){
                alert("姓名不合规范！");
                return false;
            }
            var email=document.getElementById("email").value;
            var reg_1 = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
            if(reg_1.test(email)==false){
                alert("邮箱输入有误！");
                return false;
            }
            var xh=document.getElementById("xuehao").value;
            var reg = /^20\d{8}$/;
            if(reg.test(xh)==false){
                alert("学号格式不正确！");
                return false;
            }
            var birthday=document.getElementById("birthday").value;
            var birthdayreg = /^[1-9]\d{3}-[0-3]\d-[0-3]\d$/;
            if(birthdayreg.test(birthday)==false&&birthday!=""){
                alert("出生日期格式不正确！（xxxx-xx-xx）");
                return false;
            }
            var joindate=document.getElementById("joindate").value;
            var joindatereg = /^[1-9]\d{3}-[0-3]\d-[0-3]\d$/;
            if(joindatereg.test(joindate)==false&&joindate!=""){
                alert("进入实验室日期格式不正确！");
                return false;
            }
            var qq=document.getElementById("qq").value;
            var reg2=/^\d{5,11}$/;
            if(reg2.test(qq)==false&&qq!=""){
                alert("请输入有效的QQ号码！");
                return false;
            }
            var ph=document.getElementById("phone").value;
            var reg1 = /^1[3|4|5|7|8][0-9]{9}$/;
            if(reg1.test(ph)==false&&ph!=""){
                alert("请输入有效的联系方式！");
                return false;
            }
            var zu=document.getElementById("zu").value;
            var sex=document.getElementById("sex").value;
            if(zu==""||sex==""){
                alert("请检查是否有未填项！")
                return false;
            }
            return true;
        }

    </script>
</head>
<body>

<div class="pc-kk-form" style="height:260px;overflow-x: hidden;overflow-y: scroll;">
    <h1>编辑用户</h1>
    <form method="post">
        <input type="hidden" value="${member.m_id}" name="member[m_id]">
        <div class="pc-kk-form-list pc-kk-form-list-clear">
            <div class="nice-selecter" name="nice-select">
                <span>姓名</span><input type="text" placeholder="姓名" value="${member.m_realname}" name="member[m_realname]" required="required" id="realname" autocomplete="off">
            </div>
            <div class="nice-selecter" name="nice-select" style="float:right">
                <span>邮箱</span><input type="text" placeholder="邮箱" value="${member.m_email}" name="member[m_email]" id="email" required="required" autocomplete="off">
            </div>
        </div>
        <div class="pc-kk-form-list pc-kk-form-list-clear">
            <div class="nice-selecter" name="nice-select">
                <span>学号</span><input type="text" placeholder="学号" value="${member.m_studentNumber}" name="member[m_studentNumber]" required="required" id="xuehao" autocomplete="off">
            </div>
            <div class="nice-selecter" name="nice-select" style="float:right">
                <span>寝室号</span><input type="text" placeholder="寝室号(211#315)" value="${member.m_dormitory}" name="member[m_dormitory]" required="required" autocomplete="off">
            </div>
        </div>
        <div class="pc-kk-form-list pc-kk-form-list-clear">
            <div class="nice-select" name="nice-select">
                <input type="hidden" name="member[m_group]" id="group" value="${member.m_group}">
                <span>组别</span><input type="text" placeholder="组别" value="${mygroup.g_gname}" required="required" readonly id="zu">
                <ul>
                    #for(Group group : groups)
                    <li data-value="${group.g_id}">${group.g_gname}</li>
                    #end
                </ul>
            </div>
            <div class="nice-select" name="nice-select" style="float:right">
                <input type="hidden" name="member[m_sex]" id="sex2" value="${member.m_sex}">
                #set(sex="男")
                #if(member.m_sex==2)
                #set(sex="女")
                #end
                <span>性别</span><input type="text" placeholder="性别" value="${sex}" required="required" readonly id="sex">
                <ul>
                    <li data-value="1">男</li>
                    <li data-value="2">女</li>
                </ul>

            </div>
        </div>
        <div class="pc-kk-form-list pc-kk-form-list-clear">
            <div class="nice-selecter" name="nice-select">
                <span>出生日期</span><input type="text" style="width:50%;" value="${member.m_birthday}" name="member[m_birthday]" id="birthday" class="form-control" placeholder="出生日期"  required="required"/>
            </div>
            <div class="nice-selecter" name="nice-select" style="float:right">
                <span>加入日期</span><input type="text" style="width:50%;" value="${member.m_joindate}" name="member[m_joindate]" id="joindate" class="form-control" placeholder="进入实验室日期" required="required"/>
            </div>
        </div>
        <div class="pc-kk-form-list pc-kk-form-list-clear">
            <div class="nice-selecter" name="nice-select">
                <span>QQ</span><input type="text" placeholder="QQ" name="member[m_qq]" value="${member.m_qq}" required="required" id="qq" autocomplete="off">
            </div>
            <div class="nice-selecter" name="nice-select" style="float:right">
                <span>电话</span><input type="text" placeholder="联系电话" value="${member.m_phone}" name="member[m_phone]" required="required" id="phone" autocomplete="off">
            </div>
        </div>
        <div class="pc-kk-form-list" style="height:auto">
            <span style="margin-left:10px;">毕业去向/打算</span><textarea placeholder="毕业去向/打算" name="member[m_trace]" required="required">$!{member.m_trace}</textarea>
        </div>
        <div class="pc-kk-form-btn">
            <button class="editUser" type="button">Submit</button>
        </div>
    </form>
</div>


<script type="text/javascript" src="/static/js/wanshan/jquery.js"></script>
<script src='/static/js/wanshan/selectUi.js' type='text/javascript'></script>

<script>
    $(".editUser").click(function(){
        if(checkform())
        {
            $.ajax({
                url:"/backstage/doEditUser",
                dataType:"json",
                type:"post",
                data:$("form").serialize(),
                success:function(result){
                    alert(result.tips);
                    window.location.href=location.href;
                },
                error:function(result){
                    alert("系统繁忙！");
                 }
            });
        }
    });

    $('[name="nice-select"]').click(function(e){

        $('[name="nice-select"]').find('ul').hide();

        $(this).find('ul').show();

        e.stopPropagation();

    });

    $('[name="nice-select"] li').hover(function(e){

        $(this).toggleClass('on');

        e.stopPropagation();

    });

    $('[name="nice-select"] li').click(function(e){

        var val = $(this).text();

        var val2 = $(this).attr("data-value");

        $(this).parents('[name="nice-select"]').find('input').val(val);

        $(this).parents('[name="nice-select"]').find("input[type='hidden']").val(val2);

        $('[name="nice-select"] ul').hide();

        e.stopPropagation();

    });

    $(document).click(function(){

        $('[name="nice-select"] ul').hide();

    });

</script>
</body>
</html>